home *** CD-ROM | disk | FTP | other *** search
/ MacFormat 1997 August / macformat-053.iso / mac / Shareware Plus / Developers / FuncComp.f / Read me < prev   
Encoding:
Text File  |  1997-04-19  |  2.2 KB  |  53 lines  |  [ttro/ttxt]

  1. What is it…
  2.         It is a libray that can convert any (at least most of them) math function given by character string into an internal function, which value can be rather fast computed given for given X. So once again:
  3.     (1) string -> internal function f(x) - this step is done once (fairly fast)
  4.     (2) y = f(x) - this step can be repeated many times (rather fast)
  5.  
  6. About the library…
  7. This small lib contains two very useful functions that can do what follows:                                                                                           
  8. 1° void BuildFunction (char inS) - converts string of characters into a fast computable internal form     
  9. 2° double CalcFunc(double X) - fast compute the value of converted string for given X         
  10.                                                                               
  11. THIS IS NOT FREE (unfortunately) It is a shareware. I have spend few hard days on creating it and I think it's worth $5. Please send me the money if you are going to write something using this lib.
  12.  
  13. Some technical information:
  14.  • All data is kept in global variables (1.2 kB)
  15.  • All operations are performed using 'double' data type
  16.  • Errors are returned via global variable funcErr
  17.  • ANSI math is used to perform opertions (math.h)
  18.  • String function is precompiled & optimised (operations on constants are performed)
  19.  • I wish, it was also PowerPC native but I haven't got the right compilator
  20.      so I'm waiting to get some money and to buy one
  21.  
  22. Lib Supports:
  23.  • Operators: +, -, *, /, ^
  24.  • Allowed unpaired brackets - over 20
  25.  • Functions:
  26.             - trigonometric functions: sin(x), cos(x), tan(x), cot(x), arcsin(x), arccos(x), arctan(x), arccot(x)
  27.             - hyperbolic functions: sinh(x), cosh(x), tanh(x), coth(x),arcsinh(x),arccosh(x),arctanh(x),arccoth(x)
  28.             - other:    exp(x),log(x),ln(x),int(x) {integer}, frac(x) {fraction},sqrt(x) {square root},
  29.                                         abs(x) {absolute value},(x)!  {factorial},    (x)° {degree},E,PI                    
  30.  
  31. Examples:
  32.     1° (sin):                            x-x^3/3!+x^5/5!-x^7/7!+x^9/9!
  33.     2° (parabola):        2x^2-3x+5 or 2xx-3x+5
  34.     3° (any other):    2(5x-2)(3x+5)-2ln(x^2-3x)+xx
  35.  
  36.  
  37. Function example:
  38.  
  39. void main(void)
  40. {
  41.     Str255 s = "2x^2-3x+5";   // any math C-style string
  42.     double y;
  43.     
  44.     BuildFunction(s);               // build it (internally)
  45.     
  46.     y = CalcFunc(10);
  47.     }
  48.  
  49. Send comments to:
  50.     Zdzisiek Losvik
  51.         Gdynia 81-523
  52. Przemyslawa 12a, POLAND
  53.